package com.enjoy.ioc.event;

import org.jetbrains.annotations.NotNull;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class A {

    @Bean
    public ApplicationListener<ApplicationEvent> applicationListener() {
        return new ApplicationListener<ApplicationEvent>() {
            @Override
            public void onApplicationEvent(@NotNull ApplicationEvent event) {
                System.out.println("接收到一个事件");
                System.out.println(event);
            }
        };
    }
}
